#ifndef _GAMEPAGE_H__
#define  _GAMEPAGE_H__
#include "cocos2d.h"
#include "Box2D/Box2D.h"
#include "SimpleAudioEngine.h"
#include "MyContactListener.h"
#include "GLES-Render.h"
class GamePage :public cocos2d::CCLayer
{
public:
	static cocos2d::CCScene *scene();
	LAYER_CREATE_FUNC(GamePage);
	bool init();
	bool initBackGround();
	bool initBoxGround();
	bool initBalls();
	void update(float dt);
	void initByTime(float dt);
	void initForceRegin();

	void initMenu();
	void gaveforce(cocos2d::CCObject *psender);
	cocos2d::CCAnimate* initAnimation();

	void bombCallBack(cocos2d::CCNode *node);
	void initTimeBar();
	bool ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
	void ccTouchMoved(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
	void ccTouchEnded(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
	bool isPointInObject(cocos2d::CCPoint pt);
	
	void onEnter();
	void onExit();
	void draw();
	void step(float ft);
	static float scale;
	static float scaleX;
	static float scaleY;
	b2World *world;
	vector<b2Body *> can_line_list;
	cocos2d::CCRenderTexture *m_pTarget;
	cocos2d::CCSprite *m_pBrush;
	int a;
	cocos2d::CCPoint myPoint;
	bool k;
	MyContactListener *_contactsListener;
	vector<cocos2d::CCPoint> pointlist;
	GLESDebugDraw *debugDraw;
	cocos2d::CCProgressTimer *timer;
	float current_timer_percentage_;
	float speed_of_timer;
	float bgscalex;
	float bgscaley;
	cocos2d::CCSpriteFrameCache *cache;
	b2Fixture *forcefix;
	//cocos2d::CCActionInterval 



protected:
private:
};
#endif